using System;
using System.Collections.Generic;

namespace Kiwi.Node.Modules
{
    public class ModuleResolver : Dictionary<string, Func<IApplication, object>>, IModuleResolver
    {
        #region IModuleResolver Members

        public IResolvedModule TryResolveDynamic(IApplication application, string folder, string moduleName)
        {
            Func<IApplication, object> factory;
            return TryGetValue(moduleName, out factory)
                       ? new ResolvedModule(factory)
                             {
                                 Key = moduleName,
                                 Path = ""
                             }
                       : null;
        }

        #endregion
    }
}